<template><!--感兴趣的课程-->
    <div>
        <span>猜你喜欢~</span>
         <el-button type="primary" style="margin-left: 670px;" @click="rush()">换一换</el-button>
        <!--<div v-if="simis.length!=0" style="display: flex;flex-wrap: wrap;">
            <span>为你推荐其它课程</span>
        <el-card  v-for="item in simis" style="width:250px;margin-left: 20px;">
            
            <img referrer="no-referrer|origin|unsafe-url" referrerPolicy="no-referrer"  :src="item.img" width="200px" />
            <br>
            {{item.name}}
            <br>
            {{item.introduction}}
            <br>
            <a  referrer="no-referrer|origin|unsafe-url" referrerPolicy="no-referrer"  :href="item.url" style="color: blue;" target="_blank" >前往学习~~~~~</a>   
        
        </el-card>
        </div>
        <div v-else>
            <el-span>暂无课程推荐~</el-span>
        </div> -->
    
        <div v-if="resource_simis!=0"  style="display: flex;flex-wrap: wrap;">
            
            
            <el-card  v-for="item in resource_simis" style="width:250px;margin-left: 20px;">
            
            <img referrer="no-referrer|origin|unsafe-url" referrerPolicy="no-referrer"  :src="item.img" width="200px" />
            <br>
            {{item.name}}
            <br>
            {{item.introduction}}
            <br>
            <a  referrer="no-referrer|origin|unsafe-url" referrerPolicy="no-referrer"  :href="item.url" style="color: blue;" target="_blank" >前往学习~~~~~</a>   
        
        </el-card>
        </div>
        <div v-if="resource_simis==0">
            <el-span>还未收藏任何资源，去看看哪些资源喜欢吧~</el-span>
        </div>
        
        
        
    </div>    
    
    </template>
    
    <script>
    import axios from 'axios';
    import { update } from 'lodash';
    
    
    export default{
        data(){
            return{
                simis:[],
                resource_simis:[],
            };
        },
        created(){
            this.get_resouces();
            this.rush();
        },
        
        methods:{
            get_resouces(){
                axios.get("http://localhost:9090/get_simi_course").then(res=>{
                console.log(res.data)
                this.simis=res.data
            })
            },
    
            rush(){
                axios.put("http://localhost:9090/rush_course",{
                    id:this.$store.getters.token.split(",")[2],
                }).then(res=>{
                    this.get_resouces();
                    this.resource_simis=res.data;
                })
                
            }
        }
    }
    
    
    
    </script>
    
    <style>
    
    </style>